import Vue from 'vue'
import App from './App'
import './css/app.css'
import store from './store';
import { errTips, tools } from './utils/global'

import '../static/weui/weui.css'



Vue.config.productionTip = false;
App.mpType = 'app';

Vue.prototype.$store = store
Vue.prototype.$err = errTips
Vue.prototype.$tools = tools


// 系统信息
wx.getSystemInfo({
  success (res) {
    console.warn('getSystemInfoSync————> ', res)

    let modelmes = res.model
    let isIphone = false
    isIphone = modelmes && modelmes.search('iPhone') !== -1

    Vue.prototype.isIphoneX = modelmes && modelmes.search('iPhone X') !== -1
    Vue.prototype.isIphone = modelmes && modelmes.search('iPhone') !== -1

    // 自定义顶部导航栏
    let canCustomNav = tools.compareVersion(res.SDKVersion || '1.0.0', '1.7.0') >= 0
    let statusBarHeight = res.statusBarHeight ? res.statusBarHeight : 44
    console.log('canCustomNav————>' + canCustomNav)
    console.log('statusBarHeight————>' + statusBarHeight)

    Vue.prototype.canCustomNav = canCustomNav
    Vue.prototype.statusBarHeight = canCustomNav ? statusBarHeight : -44
    Vue.prototype.windowWidth = res.windowWidth
console.log(res.screenHeight-res.windowHeight)
    // 自定义 tabbar 高度为 48
    let tabBarHeight = res.screenHeight - res.windowHeight
    let tabBarPaddingBottom = isIphone ? tabBarHeight - 48 : 0
    Vue.prototype.$tabBarHeight = tabBarHeight
    Vue.prototype.$tabBarPaddingBottom = tabBarPaddingBottom < 0 ? 0 : tabBarPaddingBottom

    Vue.prototype.$isHideTabBar = !!wx.hideTabBar
    Vue.prototype.globalData = {
      profileBannerConfig: {
        banner_image: '',
        page_url: '',
        show: false
      }
    }
    // Vue.prototype.$isHideTabBar = false

    console.warn('$tabBarHeight————> ' + tabBarHeight)
    console.warn('$tabBarPaddingBottom————> ' + tabBarPaddingBottom)
  }
})




const app = new Vue({
  App
})
app.$mount();
